﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PHRClient.DoctorForms.PatientRegister
{
    public partial class GeneralInformation : Form
    {
        private static Patient _patient;

        public GeneralInformation()
        {
            InitializeComponent();
            this.TopLevel = false;
            this.AutoScroll = true;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Dock = DockStyle.Fill;
        }

        public Patient getPatientInfo()
        {
            _patient = new Patient();

            bool isvalied = true;

            if (nameTB.Text != null && nameTB.Text != "")
                _patient.Name = nameTB.Text;
            else isvalied = false;

            if (telTB.Text != null && telTB.Text != "")
                _patient.Tel = telTB.Text;
            else isvalied = false;

            if (addressTB.Text != null && addressTB.Text != "")
                _patient.Address = addressTB.Text;
            else isvalied = false;

            if (telTB.Text != null && telTB.Text != "")
                _patient.Birthday = birthDateTimePicker.Value.ToString("MM/dd/yyyy");
            else isvalied = false;

            if (weightTB.Text != null && weightTB.Text != "")
                _patient.WeightKg = weightTB.Text;
            else isvalied = false;

            if (heightTB.Text != null && heightTB.Text != "")
                _patient.HeightCm = heightTB.Text;
            else isvalied = false;

            if (maleRB.Checked)
            {
                _patient.Gender = "Male";
            }
            else if (femaleRB.Checked)
            {
                _patient.Gender = "Female";
            }
            else 
            {
                isvalied = false;
            }

            if (isvalied)
                return _patient;
            else return null;
        }
    }
}
